<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="./index2.css">

</head>
<body>
    <div class="container">
        <div class="item"> 
            <p>标题：</p>
            <input type="text" style="width:60vw">
            <p>留言：</p>
            <textarea id="in"  style="width:60vw;height: 20vh;"></textarea>
            <br>
            <button id="but" type="button" onclick="myFunction()">取消</button>
            <button id="but" type="button" onclick="myFunction()">保存</button>
        </div>
    </div>

<script>
function myFunction() {
    var x, text;

    // 获取 id="numb" 的值
    x = document.getElementById("numb").value;

    // 如果输入的值 x 不是数字或者小于 1 或者大于 10，则提示错误 Not a Number or less than one or greater than 10
    if (isNaN(x) || x < 1 || x > 10) {
        text = "输入错误";
    } else {
        text = "输入正确";
    }
    document.getElementById("demo").innerHTML = text;
}
</script>

</body>
</html>